/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.dto.sqlServer;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author zhangYY
* @date 2024-01-12
**/
@Entity
@Data
@Table(name="storage")
public class Storage implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "储位id")
    private Integer id;

    @Column(name = "`storage_code`",unique = true,nullable = false)
    @NotBlank
    @ApiModelProperty(value = "储位编码")
    private String storageCode;

    @Column(name = "`pallet_id`")
    @ApiModelProperty(value = "载盘id")
    private Integer palletId;

    @Column(name = "`work_num`")
    @ApiModelProperty(value = "工程号")
    private String workNum;

    @Column(name = "`logical_address_type`")
    @ApiModelProperty(value = "逻辑地址类型")
    private Integer logicalAddressType;

    @Column(name = "`zone_code`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "库区编码")
    private String zoneCode;

    @Column(name = "`aisle`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "巷道号")
    private Integer aisle;

    @Column(name = "`layer`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "层号")
    private Integer layer;

    @Column(name = "`row`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "排号")
    private Integer row;

    @Column(name = "`column`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "列号")
    private Integer column;

    @Column(name = "`location_inventory_status`")
    @ApiModelProperty(value = "货位状态(0-无货1-有货)")
    private Integer locationInventoryStatus;

    @Column(name = "`status`")
    @ApiModelProperty(value = "是否启用(0-禁用 1-启用)")
    private Integer status;

    public void copy(Storage source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
